\documentclass[11pt]{article}

    \usepackage[breakable]{tcolorbox}
    \usepackage{parskip} % Stop auto-indenting (to mimic markdown behaviour)
    
    \usepackage{iftex}
    \ifPDFTeX
    	\usepackage[T1]{fontenc}
    	\usepackage{mathpazo}
    \else
    	\usepackage{fontspec}
    \fi

    % Basic figure setup, for now with no caption control since it's done
    % automatically by Pandoc (which extracts ![](path) syntax from Markdown).
    \usepackage{graphicx}
    % Maintain compatibility with old templates. Remove in nbconvert 6.0
    \let\Oldincludegraphics\includegraphics
    % Ensure that by default, figures have no caption (until we provide a
    % proper Figure object with a Caption API and a way to capture that
    % in the conversion process - todo).
    \usepackage{caption}
    \DeclareCaptionFormat{nocaption}{}
    \captionsetup{format=nocaption,aboveskip=0pt,belowskip=0pt}

    \usepackage{float}
    \floatplacement{figure}{H} % forces figures to be placed at the correct location
    \usepackage{xcolor} % Allow colors to be defined
    \usepackage{enumerate} % Needed for markdown enumerations to work
    \usepackage{geometry} % Used to adjust the document margins
    \usepackage{amsmath} % Equations
    \usepackage{amssymb} % Equations
    \usepackage{textcomp} % defines textquotesingle
    % Hack from http://tex.stackexchange.com/a/47451/13684:
    \AtBeginDocument{%
        \def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
    }
    \usepackage{upquote} % Upright quotes for verbatim code
    \usepackage{eurosym} % defines \euro
    \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
    \usepackage{fancyvrb} % verbatim replacement that allows latex
    \usepackage{grffile} % extends the file name processing of package graphics 
                         % to support a larger range
    \makeatletter % fix for old versions of grffile with XeLaTeX
    \@ifpackagelater{grffile}{2019/11/01}
    {
      % Do nothing on new versions
    }
    {
      \def\Gread@@xetex#1{%
        \IfFileExists{"\Gin@base".bb}%
        {\Gread@eps{\Gin@base.bb}}%
        {\Gread@@xetex@aux#1}%
      }
    }
    \makeatother
    \usepackage[Export]{adjustbox} % Used to constrain images to a maximum size
    \adjustboxset{max size={0.9\linewidth}{0.9\paperheight}}

    % The hyperref package gives us a pdf with properly built
    % internal navigation ('pdf bookmarks' for the table of contents,
    % internal cross-reference links, web links for URLs, etc.)
    \usepackage{hyperref}
    % The default LaTeX title has an obnoxious amount of whitespace. By default,
    % titling removes some of it. It also provides customization options.
    \usepackage{titling}
    \usepackage{longtable} % longtable support required by pandoc >1.10
    \usepackage{booktabs}  % table support for pandoc > 1.12.2
    \usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment)
    \usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)
                                % normalem makes italics be italics, not underlines
    \usepackage{mathrsfs}
    

    
    % Colors for the hyperref package
    \definecolor{urlcolor}{rgb}{0,.145,.698}
    \definecolor{linkcolor}{rgb}{.71,0.21,0.01}
    \definecolor{citecolor}{rgb}{.12,.54,.11}

    % ANSI colors
    \definecolor{ansi-black}{HTML}{3E424D}
    \definecolor{ansi-black-intense}{HTML}{282C36}
    \definecolor{ansi-red}{HTML}{E75C58}
    \definecolor{ansi-red-intense}{HTML}{B22B31}
    \definecolor{ansi-green}{HTML}{00A250}
    \definecolor{ansi-green-intense}{HTML}{007427}
    \definecolor{ansi-yellow}{HTML}{DDB62B}
    \definecolor{ansi-yellow-intense}{HTML}{B27D12}
    \definecolor{ansi-blue}{HTML}{208FFB}
    \definecolor{ansi-blue-intense}{HTML}{0065CA}
    \definecolor{ansi-magenta}{HTML}{D160C4}
    \definecolor{ansi-magenta-intense}{HTML}{A03196}
    \definecolor{ansi-cyan}{HTML}{60C6C8}
    \definecolor{ansi-cyan-intense}{HTML}{258F8F}
    \definecolor{ansi-white}{HTML}{C5C1B4}
    \definecolor{ansi-white-intense}{HTML}{A1A6B2}
    \definecolor{ansi-default-inverse-fg}{HTML}{FFFFFF}
    \definecolor{ansi-default-inverse-bg}{HTML}{000000}

    % common color for the border for error outputs.
    \definecolor{outerrorbackground}{HTML}{FFDFDF}

    % commands and environments needed by pandoc snippets
    % extracted from the output of `pandoc -s`
    \providecommand{\tightlist}{%
      \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
    \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
    % Add ',fontsize=\small' for more characters per line
    \newenvironment{Shaded}{}{}
    \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
    \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
    \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
    \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
    \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
    \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
    \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
    \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
    \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
    \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
    \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
    \newcommand{\RegionMarkerTok}[1]{{#1}}
    \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
    \newcommand{\NormalTok}[1]{{#1}}
    
    % Additional commands for more recent versions of Pandoc
    \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}}
    \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
    \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
    \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}}
    \newcommand{\ImportTok}[1]{{#1}}
    \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}}
    \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
    \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
    \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}}
    \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
    \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}}
    \newcommand{\BuiltInTok}[1]{{#1}}
    \newcommand{\ExtensionTok}[1]{{#1}}
    \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}}
    \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}}
    \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
    \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
    
    
    % Define a nice break command that doesn't care if a line doesn't already
    % exist.
    \def\br{\hspace*{\fill} \\* }
    % Math Jax compatibility definitions
    \def\gt{>}
    \def\lt{<}
    \let\Oldtex\TeX
    \let\Oldlatex\LaTeX
    \renewcommand{\TeX}{\textrm{\Oldtex}}
    \renewcommand{\LaTeX}{\textrm{\Oldlatex}}
    % Document parameters
    % Document title
    \title{ex\_3\_6}
    
    
    
    
    
% Pygments definitions
\makeatletter
\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax%
    \let\PY@ul=\relax \let\PY@tc=\relax%
    \let\PY@bc=\relax \let\PY@ff=\relax}
\def\PY@tok#1{\csname PY@tok@#1\endcsname}
\def\PY@toks#1+{\ifx\relax#1\empty\else%
    \PY@tok{#1}\expandafter\PY@toks\fi}
\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{%
    \PY@it{\PY@bf{\PY@ff{#1}}}}}}}
\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}}

\@namedef{PY@tok@w}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\@namedef{PY@tok@c}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@cp}{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
\@namedef{PY@tok@k}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kp}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kt}{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
\@namedef{PY@tok@o}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@ow}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\@namedef{PY@tok@nb}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@nf}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PY@tok@nc}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PY@tok@nn}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PY@tok@ne}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
\@namedef{PY@tok@nv}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@no}{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
\@namedef{PY@tok@nl}{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
\@namedef{PY@tok@ni}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
\@namedef{PY@tok@na}{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
\@namedef{PY@tok@nt}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@nd}{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\@namedef{PY@tok@s}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@sd}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@si}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
\@namedef{PY@tok@se}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
\@namedef{PY@tok@sr}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
\@namedef{PY@tok@ss}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@sx}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@m}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@gh}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\@namedef{PY@tok@gu}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
\@namedef{PY@tok@gd}{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
\@namedef{PY@tok@gi}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
\@namedef{PY@tok@gr}{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
\@namedef{PY@tok@ge}{\let\PY@it=\textit}
\@namedef{PY@tok@gs}{\let\PY@bf=\textbf}
\@namedef{PY@tok@gp}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\@namedef{PY@tok@go}{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\@namedef{PY@tok@gt}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
\@namedef{PY@tok@err}{\def\PY@bc##1{{\setlength{\fboxsep}{-\fboxrule}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}}
\@namedef{PY@tok@kc}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kd}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kn}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kr}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@bp}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@fm}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PY@tok@vc}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@vg}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@vi}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@vm}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@sa}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@sb}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@sc}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@dl}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@s2}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@sh}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@s1}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@mb}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@mf}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@mh}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@mi}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@il}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@mo}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@ch}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@cm}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@cpf}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@c1}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@cs}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}

\def\PYZbs{\char`\\}
\def\PYZus{\char`\_}
\def\PYZob{\char`\{}
\def\PYZcb{\char`\}}
\def\PYZca{\char`\^}
\def\PYZam{\char`\&}
\def\PYZlt{\char`\<}
\def\PYZgt{\char`\>}
\def\PYZsh{\char`\#}
\def\PYZpc{\char`\%}
\def\PYZdl{\char`\$}
\def\PYZhy{\char`\-}
\def\PYZsq{\char`\'}
\def\PYZdq{\char`\"}
\def\PYZti{\char`\~}
% for compatibility with earlier versions
\def\PYZat{@}
\def\PYZlb{[}
\def\PYZrb{]}
\makeatother


    % For linebreaks inside Verbatim environment from package fancyvrb. 
    \makeatletter
        \newbox\Wrappedcontinuationbox 
        \newbox\Wrappedvisiblespacebox 
        \newcommand*\Wrappedvisiblespace {\textcolor{red}{\textvisiblespace}} 
        \newcommand*\Wrappedcontinuationsymbol {\textcolor{red}{\llap{\tiny$\m@th\hookrightarrow$}}} 
        \newcommand*\Wrappedcontinuationindent {3ex } 
        \newcommand*\Wrappedafterbreak {\kern\Wrappedcontinuationindent\copy\Wrappedcontinuationbox} 
        % Take advantage of the already applied Pygments mark-up to insert 
        % potential linebreaks for TeX processing. 
        %        {, <, #, %, $, ' and ": go to next line. 
        %        _, }, ^, &, >, - and ~: stay at end of broken line. 
        % Use of \textquotesingle for straight quote. 
        \newcommand*\Wrappedbreaksatspecials {% 
            \def\PYGZus{\discretionary{\char`\_}{\Wrappedafterbreak}{\char`\_}}% 
            \def\PYGZob{\discretionary{}{\Wrappedafterbreak\char`\{}{\char`\{}}% 
            \def\PYGZcb{\discretionary{\char`\}}{\Wrappedafterbreak}{\char`\}}}% 
            \def\PYGZca{\discretionary{\char`\^}{\Wrappedafterbreak}{\char`\^}}% 
            \def\PYGZam{\discretionary{\char`\&}{\Wrappedafterbreak}{\char`\&}}% 
            \def\PYGZlt{\discretionary{}{\Wrappedafterbreak\char`\<}{\char`\<}}% 
            \def\PYGZgt{\discretionary{\char`\>}{\Wrappedafterbreak}{\char`\>}}% 
            \def\PYGZsh{\discretionary{}{\Wrappedafterbreak\char`\#}{\char`\#}}% 
            \def\PYGZpc{\discretionary{}{\Wrappedafterbreak\char`\%}{\char`\%}}% 
            \def\PYGZdl{\discretionary{}{\Wrappedafterbreak\char`\$}{\char`\$}}% 
            \def\PYGZhy{\discretionary{\char`\-}{\Wrappedafterbreak}{\char`\-}}% 
            \def\PYGZsq{\discretionary{}{\Wrappedafterbreak\textquotesingle}{\textquotesingle}}% 
            \def\PYGZdq{\discretionary{}{\Wrappedafterbreak\char`\"}{\char`\"}}% 
            \def\PYGZti{\discretionary{\char`\~}{\Wrappedafterbreak}{\char`\~}}% 
        } 
        % Some characters . , ; ? ! / are not pygmentized. 
        % This macro makes them "active" and they will insert potential linebreaks 
        \newcommand*\Wrappedbreaksatpunct {% 
            \lccode`\~`\.\lowercase{\def~}{\discretionary{\hbox{\char`\.}}{\Wrappedafterbreak}{\hbox{\char`\.}}}% 
            \lccode`\~`\,\lowercase{\def~}{\discretionary{\hbox{\char`\,}}{\Wrappedafterbreak}{\hbox{\char`\,}}}% 
            \lccode`\~`\;\lowercase{\def~}{\discretionary{\hbox{\char`\;}}{\Wrappedafterbreak}{\hbox{\char`\;}}}% 
            \lccode`\~`\:\lowercase{\def~}{\discretionary{\hbox{\char`\:}}{\Wrappedafterbreak}{\hbox{\char`\:}}}% 
            \lccode`\~`\?\lowercase{\def~}{\discretionary{\hbox{\char`\?}}{\Wrappedafterbreak}{\hbox{\char`\?}}}% 
            \lccode`\~`\!\lowercase{\def~}{\discretionary{\hbox{\char`\!}}{\Wrappedafterbreak}{\hbox{\char`\!}}}% 
            \lccode`\~`\/\lowercase{\def~}{\discretionary{\hbox{\char`\/}}{\Wrappedafterbreak}{\hbox{\char`\/}}}% 
            \catcode`\.\active
            \catcode`\,\active 
            \catcode`\;\active
            \catcode`\:\active
            \catcode`\?\active
            \catcode`\!\active
            \catcode`\/\active 
            \lccode`\~`\~ 	
        }
    \makeatother

    \let\OriginalVerbatim=\Verbatim
    \makeatletter
    \renewcommand{\Verbatim}[1][1]{%
        %\parskip\z@skip
        \sbox\Wrappedcontinuationbox {\Wrappedcontinuationsymbol}%
        \sbox\Wrappedvisiblespacebox {\FV@SetupFont\Wrappedvisiblespace}%
        \def\FancyVerbFormatLine ##1{\hsize\linewidth
            \vtop{\raggedright\hyphenpenalty\z@\exhyphenpenalty\z@
                \doublehyphendemerits\z@\finalhyphendemerits\z@
                \strut ##1\strut}%
        }%
        % If the linebreak is at a space, the latter will be displayed as visible
        % space at end of first line, and a continuation symbol starts next line.
        % Stretch/shrink are however usually zero for typewriter font.
        \def\FV@Space {%
            \nobreak\hskip\z@ plus\fontdimen3\font minus\fontdimen4\font
            \discretionary{\copy\Wrappedvisiblespacebox}{\Wrappedafterbreak}
            {\kern\fontdimen2\font}%
        }%
        
        % Allow breaks at special characters using \PYG... macros.
        \Wrappedbreaksatspecials
        % Breaks at punctuation characters . , ; ? ! and / need catcode=\active 	
        \OriginalVerbatim[#1,codes*=\Wrappedbreaksatpunct]%
    }
    \makeatother

    % Exact colors from NB
    \definecolor{incolor}{HTML}{303F9F}
    \definecolor{outcolor}{HTML}{D84315}
    \definecolor{cellborder}{HTML}{CFCFCF}
    \definecolor{cellbackground}{HTML}{F7F7F7}
    
    % prompt
    \makeatletter
    \newcommand{\boxspacing}{\kern\kvtcb@left@rule\kern\kvtcb@boxsep}
    \makeatother
    \newcommand{\prompt}[4]{
        {\ttfamily\llap{{\color{#2}[#3]:\hspace{3pt}#4}}\vspace{-\baselineskip}}
    }
    

    
    % Prevent overflowing lines due to hard-to-break entities
    \sloppy 
    % Setup hyperref package
    \hypersetup{
      breaklinks=true,  % so long urls are correctly broken across lines
      colorlinks=true,
      urlcolor=urlcolor,
      linkcolor=linkcolor,
      citecolor=citecolor,
      }
    % Slightly bigger margins than the latex defaults
    
    \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
    
    

\begin{document}
    
    \maketitle
    
    

    
    \hypertarget{ux4e60ux9898-3.6}{%
\subsection{习题 3.6}\label{ux4e60ux9898-3.6}}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{1}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{data} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{read.table}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{./ex\PYZus{}3\PYZus{}6.meaningfulize.txt\PYZdq{}}\PY{p}{,} \PY{n}{header}\PY{o}{=}\PY{k+kc}{TRUE}\PY{p}{)}
\PY{n}{data}
\end{Verbatim}
\end{tcolorbox}

    A data.frame: 108 × 3
\begin{tabular}{lll}
 FeIon & Dose & Retention\\
 <chr> & <chr> & <dbl>\\
\hline
	 Fe3 & high & 0.71\\
	 Fe3 & high & 1.66\\
	 Fe3 & high & 2.01\\
	 Fe3 & high & 2.16\\
	 Fe3 & high & 2.42\\
	 Fe3 & high & 2.42\\
	 Fe3 & high & 2.56\\
	 Fe3 & high & 2.60\\
	 Fe3 & high & 3.31\\
	 Fe3 & high & 3.64\\
	 Fe3 & high & 3.74\\
	 Fe3 & high & 3.74\\
	 Fe3 & high & 4.39\\
	 Fe3 & high & 4.50\\
	 Fe3 & high & 5.07\\
	 Fe3 & high & 5.26\\
	 Fe3 & high & 8.15\\
	 Fe3 & high & 8.24\\
	 Fe3 & mid  & 2.20\\
	 Fe3 & mid  & 2.93\\
	 Fe3 & mid  & 3.08\\
	 Fe3 & mid  & 3.49\\
	 Fe3 & mid  & 4.11\\
	 Fe3 & mid  & 4.95\\
	 Fe3 & mid  & 5.16\\
	 Fe3 & mid  & 5.54\\
	 Fe3 & mid  & 5.68\\
	 Fe3 & mid  & 6.25\\
	 Fe3 & mid  & 7.25\\
	 Fe3 & mid  & 7.90\\
	 ⋮ & ⋮ & ⋮\\
	 Fe2 & mid &  5.86\\
	 Fe2 & mid &  6.28\\
	 Fe2 & mid &  6.97\\
	 Fe2 & mid &  7.06\\
	 Fe2 & mid &  7.78\\
	 Fe2 & mid &  9.23\\
	 Fe2 & mid &  9.34\\
	 Fe2 & mid &  9.91\\
	 Fe2 & mid & 13.46\\
	 Fe2 & mid & 18.40\\
	 Fe2 & mid & 23.89\\
	 Fe2 & mid & 26.39\\
	 Fe2 & low &  2.71\\
	 Fe2 & low &  5.43\\
	 Fe2 & low &  6.38\\
	 Fe2 & low &  6.38\\
	 Fe2 & low &  8.32\\
	 Fe2 & low &  9.04\\
	 Fe2 & low &  9.56\\
	 Fe2 & low & 10.01\\
	 Fe2 & low & 10.08\\
	 Fe2 & low & 10.62\\
	 Fe2 & low & 13.80\\
	 Fe2 & low & 15.99\\
	 Fe2 & low & 17.90\\
	 Fe2 & low & 18.25\\
	 Fe2 & low & 19.32\\
	 Fe2 & low & 19.87\\
	 Fe2 & low & 21.60\\
	 Fe2 & low & 22.25\\
\end{tabular}


    
    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{2}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{attach}\PY{p}{(}\PY{n}{data}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \hypertarget{section}{%
\subsubsection{(1)}\label{section}}

\begin{figure}
\centering
\includegraphics{https://tva1.sinaimg.cn/large/008i3skNly1gr7f8iaibgj31lo06y41x.jpg}
\caption{题（1）}
\end{figure}

    首先，求出各组合观测值的样本均值、标准差。这里可以利用 aggregate
做分类汇总：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{3}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{grouped\PYZus{}means} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{aggregate}\PY{p}{(}\PY{n}{Retention}\PY{p}{,} \PY{n}{by}\PY{o}{=}\PY{n+nf}{list}\PY{p}{(}\PY{n}{FeIon}\PY{p}{,} \PY{n}{Dose}\PY{p}{)}\PY{p}{,} \PY{n}{FUN}\PY{o}{=}\PY{n}{mean}\PY{p}{)}
\PY{n}{grouped\PYZus{}sds}  \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{aggregate}\PY{p}{(}\PY{n}{Retention}\PY{p}{,} \PY{n}{by}\PY{o}{=}\PY{n+nf}{list}\PY{p}{(}\PY{n}{FeIon}\PY{p}{,} \PY{n}{Dose}\PY{p}{)}\PY{p}{,} \PY{n}{FUN}\PY{o}{=}\PY{n}{sd}\PY{p}{)}

\PY{c+c1}{\PYZsh{} 下面几行代码将结果整合到一个表格，方便查看：}
\PY{n}{grouped\PYZus{}means\PYZus{}sds} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{cbind}\PY{p}{(}\PY{n}{grouped\PYZus{}means}\PY{p}{,} \PY{n}{grouped\PYZus{}sds}\PY{p}{[}\PY{l+s}{\PYZdq{}}\PY{l+s}{x\PYZdq{}}\PY{p}{]}\PY{p}{)}
\PY{n+nf}{names}\PY{p}{(}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{)} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{c}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{FeIon\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{Dose\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{mean\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{sd\PYZdq{}}\PY{p}{)}
\PY{n}{grouped\PYZus{}means\PYZus{}sds}
\end{Verbatim}
\end{tcolorbox}

    A data.frame: 6 × 4
\begin{tabular}{llll}
 FeIon & Dose & mean & sd\\
 <chr> & <chr> & <dbl> & <dbl>\\
\hline
	 Fe2 & high &  5.936667 & 2.806778\\
	 Fe3 & high &  3.698889 & 2.030870\\
	 Fe2 & low  & 12.639444 & 6.082089\\
	 Fe3 & low  & 11.750000 & 7.028150\\
	 Fe2 & mid  &  9.632222 & 6.691215\\
	 Fe3 & mid  &  8.203889 & 5.447386\\
\end{tabular}


    
    为方便观察，按 \(Fe^{2+}\)、\(Fe^{3+}\) 并排比较：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{4}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{p}{(}\PY{n+nf}{function}\PY{p}{(}\PY{p}{)} \PY{p}{\PYZob{}}
    \PY{n}{`|`} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{rep}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{|\PYZdq{}}\PY{p}{,} \PY{l+m}{3}\PY{p}{)}\PY{p}{;}  \PY{c+c1}{\PYZsh{} 这里为了显示效果取了一个 `|` 变量名，为避免后续麻烦，使用了函数包裹立即执行来隔离环境}

    \PY{n+nf}{cbind}\PY{p}{(}
        \PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{[}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{o}{\PYZdl{}}\PY{n}{FeIon}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{Fe2\PYZdq{}}\PY{p}{,}\PY{p}{]}\PY{p}{,} 
        \PY{n}{`|`}\PY{p}{,}
        \PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{[}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{o}{\PYZdl{}}\PY{n}{FeIon}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{Fe3\PYZdq{}}\PY{p}{,}\PY{p}{]}
    \PY{p}{)}
\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{(}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    A data.frame: 3 × 9
\begin{tabular}{r|lllllllll}
  & FeIon & Dose & mean & sd & \textbar{} & FeIon & Dose & mean & sd\\
  & <chr> & <chr> & <dbl> & <dbl> & <chr> & <chr> & <chr> & <dbl> & <dbl>\\
\hline
	1 & Fe2 & high &  5.936667 & 2.806778 & \textbar{} & Fe3 & high &  3.698889 & 2.030870\\
	3 & Fe2 & low  & 12.639444 & 6.082089 & \textbar{} & Fe3 & low  & 11.750000 & 7.028150\\
	5 & Fe2 & mid  &  9.632222 & 6.691215 & \textbar{} & Fe3 & mid  &  8.203889 & 5.447386\\
\end{tabular}


    
    按剂量低、中、高并排比较：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{5}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{p}{(}\PY{n+nf}{function}\PY{p}{(}\PY{p}{)} \PY{p}{\PYZob{}}
    \PY{n}{`|`} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{rep}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{|\PYZdq{}}\PY{p}{,} \PY{l+m}{2}\PY{p}{)}\PY{p}{;}  \PY{c+c1}{\PYZsh{} sep char: 这里为了显示效果取了一个 `|` 变量名，为避免后续麻烦，使用了函数包裹立即执行来隔离环境}

    \PY{n+nf}{cbind}\PY{p}{(}
        \PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{[}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{o}{\PYZdl{}}\PY{n}{Dose}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{low\PYZdq{}}\PY{p}{,}\PY{p}{]}\PY{p}{,} 
        \PY{n}{`|`}\PY{p}{,}
        \PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{[}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{o}{\PYZdl{}}\PY{n}{Dose}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{mid\PYZdq{}}\PY{p}{,}\PY{p}{]}\PY{p}{,}
        \PY{n}{`|`}\PY{p}{,}
        \PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{[}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{o}{\PYZdl{}}\PY{n}{Dose}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{high\PYZdq{}}\PY{p}{,}\PY{p}{]}
    \PY{p}{)}
\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{(}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    A data.frame: 2 × 14
\begin{tabular}{r|llllllllllllll}
  & FeIon & Dose & mean & sd & \textbar{} & FeIon & Dose & mean & sd & \textbar{} & FeIon & Dose & mean & sd\\
  & <chr> & <chr> & <dbl> & <dbl> & <chr> & <chr> & <chr> & <dbl> & <dbl> & <chr> & <chr> & <chr> & <dbl> & <dbl>\\
\hline
	3 & Fe2 & low & 12.63944 & 6.082089 & \textbar{} & Fe2 & mid & 9.632222 & 6.691215 & \textbar{} & Fe2 & high & 5.936667 & 2.806778\\
	4 & Fe3 & low & 11.75000 & 7.028150 & \textbar{} & Fe3 & mid & 8.203889 & 5.447386 & \textbar{} & Fe3 & high & 3.698889 & 2.030870\\
\end{tabular}


    
    可以画出箱线图来比较：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{6}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n+nf}{c}\PY{p}{(}\PY{l+m}{2}\PY{p}{,}\PY{l+m}{2}\PY{p}{)}\PY{p}{)}

\PY{n+nf}{boxplot}\PY{p}{(}\PY{n}{`mean`} \PY{o}{\PYZti{}} \PY{n}{`FeIon`}\PY{p}{,} \PY{n}{data}\PY{o}{=}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{)}
\PY{n+nf}{boxplot}\PY{p}{(}\PY{n}{`sd`} \PY{o}{\PYZti{}} \PY{n}{`FeIon`}\PY{p}{,} \PY{n}{data}\PY{o}{=}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{)}
\PY{n+nf}{boxplot}\PY{p}{(}\PY{n}{`mean`} \PY{o}{\PYZti{}} \PY{n}{`Dose`}\PY{p}{,} \PY{n}{data}\PY{o}{=}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{)}
\PY{n+nf}{boxplot}\PY{p}{(}\PY{n}{`sd`} \PY{o}{\PYZti{}} \PY{n}{`Dose`}\PY{p}{,} \PY{n}{data}\PY{o}{=}\PY{n}{grouped\PYZus{}means\PYZus{}sds}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_11_0.png}
    \end{center}
    { \hspace*{\fill} \\}
    
    从比较结果来看，高剂量组标准差明显异于其他两组，认为假定误差的等方差性不太合理。
所以不能直接进行方差分析。

    \hypertarget{section}{%
\subsubsection{(2)}\label{section}}

\begin{figure}
\centering
\includegraphics{https://tva1.sinaimg.cn/large/008i3skNly1gr7gc6aor7j61mu04iq4i02.jpg}
\caption{题（2）}
\end{figure}

    自然对数变换，把变换后的数据列叫做 \texttt{lnRetention}：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{7}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{lnRetention} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{log}\PY{p}{(}\PY{n}{Retention}\PY{p}{)}
\PY{n}{data} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{cbind}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{lnRetention}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    计算变换后的分组均值、标准差：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{8}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{grouped\PYZus{}ln\PYZus{}means} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{aggregate}\PY{p}{(}\PY{n}{lnRetention}\PY{p}{,} \PY{n}{by}\PY{o}{=}\PY{n+nf}{list}\PY{p}{(}\PY{n}{FeIon}\PY{p}{,} \PY{n}{Dose}\PY{p}{)}\PY{p}{,} \PY{n}{FUN}\PY{o}{=}\PY{n}{mean}\PY{p}{)}
\PY{n}{grouped\PYZus{}ln\PYZus{}sds}   \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{aggregate}\PY{p}{(}\PY{n}{lnRetention}\PY{p}{,} \PY{n}{by}\PY{o}{=}\PY{n+nf}{list}\PY{p}{(}\PY{n}{FeIon}\PY{p}{,} \PY{n}{Dose}\PY{p}{)}\PY{p}{,} \PY{n}{FUN}\PY{o}{=}\PY{n}{sd}\PY{p}{)}

\PY{c+c1}{\PYZsh{} 下面几行代码将结果整合到一个表格，方便查看：}
\PY{n}{grouped\PYZus{}ln\PYZus{}means\PYZus{}sds} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{cbind}\PY{p}{(}\PY{n}{grouped\PYZus{}ln\PYZus{}means}\PY{p}{,} \PY{n}{grouped\PYZus{}ln\PYZus{}sds}\PY{p}{[}\PY{l+s}{\PYZdq{}}\PY{l+s}{x\PYZdq{}}\PY{p}{]}\PY{p}{)}
\PY{n+nf}{names}\PY{p}{(}\PY{n}{grouped\PYZus{}ln\PYZus{}means\PYZus{}sds}\PY{p}{)} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{c}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{FeIon\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{Dose\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{mean\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{sd\PYZdq{}}\PY{p}{)}
\PY{n}{grouped\PYZus{}ln\PYZus{}means\PYZus{}sds}
\end{Verbatim}
\end{tcolorbox}

    A data.frame: 6 × 4
\begin{tabular}{llll}
 FeIon & Dose & mean & sd\\
 <chr> & <chr> & <dbl> & <dbl>\\
\hline
	 Fe2 & high & 1.680129 & 0.4645464\\
	 Fe3 & high & 1.160924 & 0.5854773\\
	 Fe2 & low  & 2.403389 & 0.5693701\\
	 Fe3 & low  & 2.279981 & 0.6563113\\
	 Fe2 & mid  & 2.090045 & 0.5736511\\
	 Fe3 & mid  & 1.901225 & 0.6585116\\
\end{tabular}


    
    作图比较：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{9}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n+nf}{c}\PY{p}{(}\PY{l+m}{2}\PY{p}{,}\PY{l+m}{2}\PY{p}{)}\PY{p}{)}

\PY{n+nf}{boxplot}\PY{p}{(}\PY{n}{`mean`} \PY{o}{\PYZti{}} \PY{n}{`FeIon`}\PY{p}{,} \PY{n}{data}\PY{o}{=}\PY{n}{grouped\PYZus{}ln\PYZus{}means\PYZus{}sds}\PY{p}{)}
\PY{n+nf}{boxplot}\PY{p}{(}\PY{n}{`sd`} \PY{o}{\PYZti{}} \PY{n}{`FeIon`}\PY{p}{,}   \PY{n}{data}\PY{o}{=}\PY{n}{grouped\PYZus{}ln\PYZus{}means\PYZus{}sds}\PY{p}{)}
\PY{n+nf}{boxplot}\PY{p}{(}\PY{n}{`mean`} \PY{o}{\PYZti{}} \PY{n}{`Dose`}\PY{p}{,}  \PY{n}{data}\PY{o}{=}\PY{n}{grouped\PYZus{}ln\PYZus{}means\PYZus{}sds}\PY{p}{)}
\PY{n+nf}{boxplot}\PY{p}{(}\PY{n}{`sd`} \PY{o}{\PYZti{}} \PY{n}{`Dose`}\PY{p}{,}    \PY{n}{data}\PY{o}{=}\PY{n}{grouped\PYZus{}ln\PYZus{}means\PYZus{}sds}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_19_0.png}
    \end{center}
    { \hspace*{\fill} \\}
    
    可以看到，现在个组标准差趋于一致，各族间标准差差异不大。
可以利用变换之后的数据进行方差分析了。

    \hypertarget{section}{%
\subsubsection{(3)}\label{section}}

\begin{figure}
\centering
\includegraphics{https://tva1.sinaimg.cn/large/008i3skNly1gr7grannygj31le050q51.jpg}
\caption{题（3）}
\end{figure}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{10}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{lnRetention.aov} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{aov}\PY{p}{(}\PY{n}{lnRetention} \PY{o}{\PYZti{}} \PY{n}{FeIon} \PY{o}{+} \PY{n}{Dose} \PY{o}{+} \PY{n}{FeIon}\PY{o}{:}\PY{n}{Dose}\PY{p}{,} \PY{n}{data}\PY{o}{=}\PY{n}{data}\PY{p}{)}
\PY{n+nf}{summary}\PY{p}{(}\PY{n}{lnRetention.aov}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    
    \begin{Verbatim}[commandchars=\\\{\}]
             Df Sum Sq Mean Sq F value   Pr(>F)    
FeIon         1   2.07   2.074   5.993   0.0161 *  
Dose          2  15.59   7.794  22.524 7.91e-09 ***
FeIon:Dose    2   0.81   0.405   1.171   0.3143    
Residuals   102  35.30   0.346                     
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    \end{Verbatim}

    
    从结果中可以看出，在显著水平 \(\alpha=0.05\) 下，
铁离子种类因素（\(\textrm{Fe}^{2+}\)、\(\textrm{Fe}^{3+}\)）和
剂量因素（剂量低、中、高）对存留量的影响均显著（检验 p 值都小于
\(0.05\)）。
即说明两种铁离子存留量是有显著差异的，不同剂量水平下存留量也是有显著差异的。

同时，可以看到在该水平下，交叉因子
(\texttt{FeIon:Dose}项）对存留量影响不显著（\(p=0.3143>0.05\)），认为两种铁离子存留量在不同剂量水平下可认为是相同的。

    \hypertarget{section}{%
\subsubsection{(4)}\label{section}}

\begin{figure}
\centering
\includegraphics{https://tva1.sinaimg.cn/large/008i3skNly1gr7haazrvej31li050acr.jpg}
\caption{题（4）}
\end{figure}

    先求各因素在不同水平下的均值以及估计区间，可以复用 3.5 中封装的
mean\_confin 函数：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{11}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{mean\PYZus{}confin} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{function}\PY{p}{(}\PY{n}{x}\PY{p}{,} \PY{k+kc}{...}\PY{p}{)} \PY{p}{\PYZob{}}    \PY{c+c1}{\PYZsh{} mean and confidence interval of x by t.test}
    \PY{n}{t.res} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{t.test}\PY{p}{(}\PY{n}{x}\PY{p}{,} \PY{k+kc}{...}\PY{p}{)}
    \PY{n}{mean\PYZus{}val} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n}{t.res}\PY{o}{\PYZdl{}}\PY{n}{estimate}\PY{p}{[[}\PY{l+s}{\PYZdq{}}\PY{l+s}{mean of x\PYZdq{}}\PY{p}{]]}
    \PY{n}{mean\PYZus{}conf.in} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n}{t.res}\PY{o}{\PYZdl{}}\PY{n}{conf.in}
    
    \PY{n}{res} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{c}\PY{p}{(}\PY{n}{mean\PYZus{}val}\PY{p}{,} \PY{n}{mean\PYZus{}conf.in}\PY{p}{)}
    \PY{n+nf}{names}\PY{p}{(}\PY{n}{res}\PY{p}{)} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{c}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{mean\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{conf.left\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{conf.right\PYZdq{}}\PY{p}{)}
    
    \PY{n}{res}  \PY{c+c1}{\PYZsh{} ret}
\PY{p}{\PYZcb{}}
\end{Verbatim}
\end{tcolorbox}

    按离子：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{12}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{p}{(}\PY{n+nf}{function}\PY{p}{(}\PY{p}{)} \PY{p}{\PYZob{}}
    \PY{n}{Fe2} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{mean\PYZus{}confin}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{n}{FeIon}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{Fe2\PYZdq{}}\PY{p}{,}\PY{p}{]}\PY{o}{\PYZdl{}}\PY{n}{lnRetention}\PY{p}{)}
    \PY{n}{Fe3} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{mean\PYZus{}confin}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{n}{FeIon}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{Fe3\PYZdq{}}\PY{p}{,}\PY{p}{]}\PY{o}{\PYZdl{}}\PY{n}{lnRetention}\PY{p}{)}
    \PY{n+nf}{rbind}\PY{p}{(}\PY{n}{Fe2}\PY{p}{,} \PY{n}{Fe3}\PY{p}{)}
\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{(}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    A matrix: 2 × 3 of type dbl
\begin{tabular}{r|lll}
  & mean & conf.left & conf.right\\
\hline
	Fe2 & 2.057854 & 1.892251 & 2.223458\\
	Fe3 & 1.780710 & 1.568011 & 1.993409\\
\end{tabular}


    
    按剂量：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{13}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{p}{(}\PY{n+nf}{function}\PY{p}{(}\PY{p}{)} \PY{p}{\PYZob{}}
    \PY{n}{Low}  \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{mean\PYZus{}confin}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{n}{Dose}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{low\PYZdq{}}\PY{p}{,}\PY{p}{]}\PY{o}{\PYZdl{}}\PY{n}{lnRetention}\PY{p}{)}
    \PY{n}{Mid}  \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{mean\PYZus{}confin}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{n}{Dose}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{mid\PYZdq{}}\PY{p}{,}\PY{p}{]}\PY{o}{\PYZdl{}}\PY{n}{lnRetention}\PY{p}{)}
    \PY{n}{High} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{mean\PYZus{}confin}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{n}{Dose}\PY{o}{==}\PY{l+s}{\PYZdq{}}\PY{l+s}{high\PYZdq{}}\PY{p}{,}\PY{p}{]}\PY{o}{\PYZdl{}}\PY{n}{lnRetention}\PY{p}{)}
    \PY{n+nf}{rbind}\PY{p}{(}\PY{n}{Low}\PY{p}{,} \PY{n}{Mid}\PY{p}{,} \PY{n}{High}\PY{p}{)}
\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{(}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    A matrix: 3 × 3 of type dbl
\begin{tabular}{r|lll}
  & mean & conf.left & conf.right\\
\hline
	Low & 2.341685 & 2.135709 & 2.547661\\
	Mid & 1.995635 & 1.787163 & 2.204107\\
	High & 1.420526 & 1.223052 & 1.618001\\
\end{tabular}


    
    利用 DescTools 包，求 Bonferroni 同时置信区间：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{14}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{c+c1}{\PYZsh{} install.packages(\PYZdq{}DescTools\PYZdq{})}
\PY{n+nf}{library}\PY{p}{(}\PY{n}{DescTools}\PY{p}{)}
\PY{n+nf}{PostHocTest}\PY{p}{(}\PY{n}{lnRetention.aov}\PY{p}{,} \PY{n}{method} \PY{o}{=} \PY{l+s}{\PYZdq{}}\PY{l+s}{bonferroni\PYZdq{}}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    
    \begin{Verbatim}[commandchars=\\\{\}]

  Posthoc multiple comparisons of means : Bonferroni 
    95\% family-wise confidence level

\$FeIon
              diff     lwr.ci      upr.ci   pval    
Fe3-Fe2 -0.2771441 -0.5016931 -0.05259515 0.0161 *  

\$Dose
               diff     lwr.ci       upr.ci    pval    
low-high  0.9211588  0.5836659  1.258651627 4.6e-09 ***
mid-high  0.5751084  0.2376156  0.912601307 0.00021 ***
mid-low  -0.3460503 -0.6835432 -0.008557451 0.04251 *  

\$`FeIon:Dose`
                        diff      lwr.ci     upr.ci    pval    
Fe3:high-Fe2:high -0.5192055 -1.10861287 0.07020194  0.1408    
Fe2:low-Fe2:high   0.7232596  0.13385220 1.31266701  0.0055 ** 
Fe3:low-Fe2:high   0.5998524  0.01044505 1.18925985  0.0425 *  
Fe2:mid-Fe2:high   0.4099156 -0.17949182 0.99932299  0.5859    
Fe3:mid-Fe2:high   0.2210958 -0.36831157 0.81050323  1.0000    
Fe2:low-Fe3:high   1.2424651  0.65305767 1.83187247 9.7e-08 ***
Fe3:low-Fe3:high   1.1190579  0.52965051 1.70846531 1.7e-06 ***
Fe2:mid-Fe3:high   0.9291210  0.33971365 1.51852845  0.0001 ***
Fe3:mid-Fe3:high   0.7403013  0.15089389 1.32970869  0.0040 ** 
Fe3:low-Fe2:low   -0.1234072 -0.71281456 0.46600024  1.0000    
Fe2:mid-Fe2:low   -0.3133440 -0.90275142 0.27606338  1.0000    
Fe3:mid-Fe2:low   -0.5021638 -1.09157118 0.08724362  0.1785    
Fe2:mid-Fe3:low   -0.1899369 -0.77934426 0.39947054  1.0000    
Fe3:mid-Fe3:low   -0.3787566 -0.96816402 0.21065078  0.8427    
Fe3:mid-Fe2:mid   -0.1888198 -0.77822716 0.40058764  1.0000    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

    \end{Verbatim}

    

    % Add a bibliography block to the postdoc
    
    
    
\end{document}
